/**
 * 
 */
package com.eshopper.product.document;

import java.math.BigDecimal;

import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.solr.client.solrj.beans.Field;
import org.springframework.data.annotation.Id;

/**
 * @author M1024355
 *
 */
public class ProductDocument {

	public static final String FIELD_PRICE = "price";
	public static final String FIELD_ID = "productId";
	public static final String FIELD_NAME = "productName";

	@Id
	@Field
	private String productId;

	@Field
	private String productName;

	@Field
	private String price;

	public ProductDocument() {
		
	}

	public static Builder getBuilder(Long productId, String productName, BigDecimal price) {
		return new Builder(productId, productName, price);
	}

	public String getProductId() {
		return productId;
	}

	public String getProductName() {
		return productName;
	}

	public String getPrice() {
		return price;
	}

	@Override
	public String toString() {
		return ReflectionToStringBuilder.toString(this);
	}

	public static class Builder {
		private ProductDocument build;

		public Builder(Long productId, String productName, BigDecimal price) {
			build = new ProductDocument();
			build.productId = productId.toString();
			build.productName = productName;
			build.price = price.toString();
		}

		public Builder productName(String productName) {
			build.productName = productName;
			return this;
		}

		public ProductDocument build() {
			return build;
		}
	}
}
